import fetch from 'common/src/utils/fetch'


/**
 *回复
 */
function reply(data) {
    return fetch({
        url: '/api/electionservice/electionApply/reply',
        method: 'post',
        data: data
    });
}

/**
 *课表中的驳回
 */
function reject(data) {
    return fetch({
        url: '/api/electionservice/electionApply/reject',
        method: 'post',
        data: data
    });
}

/**
 *查询申请课程
 */
function applyCourseList(data) {
    return fetch({
        url: '/api/electionservice/electionApply/applyCourseList',
        method: 'post',
        data: data
    });
}

/**
 *删除已处理课程
 */
function deleteCourses(calendarId) {
    return fetch({
        url: '/api/electionservice/electionApplyCourses/delete',
        params: { calendarId: calendarId },
        method: 'post',
    });
}

/**
 *申请
 */
function apply(studentId, roundId, courseCode) {
    return fetch({
        url: '/api/electionservice/electionApply/apply',
        params: { studentId: studentId, roundId: roundId, courseCode: courseCode },
        method: 'post',
    });
}

/**
 *取消申请
 */
function cancelApply(studentId, roundId, courseCode) {
    return fetch({
        url: '/api/electionservice/electionApply/cancelApply',
        params: { studentId: studentId, roundId: roundId, courseCode: courseCode },
        method: 'post',
    });
}

/**
 *已处理
 */
function alreadyApply(data) {
    return fetch({
        url: '/api/electionservice/electionApply/alreadyApplyList',
        method: 'post',
        data: data
    });
}

/**
 *未处理
 */
function applyUn(data) {
    return fetch({
        url: '/api/electionservice/electionApply/applyUnList',
        method: 'post',
        data: data
    });
}

export default {
    'reply': reply,
    'applyCourseList': applyCourseList,
    'deleteCourses': deleteCourses,
    'apply': apply,
    'cancelApply': cancelApply,
    'alreadyApply': alreadyApply,
    'applyUn': applyUn,
    'reject': reject
}
